package com.ruihu.admin.module.business.tasknode.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruihu.admin.module.business.tasknode.domain.dto.TaskNodeFileDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 *  [ 任务环节附件表 ]
 *
 * @author Tony
 * @version 1.0
 * @company 瑞虎（南京）信息技术有限公司
 * @copyright (c) 瑞虎（南京）信息技术有限公司Inc. All rights reserved.
 * @date  2022-08-30 20:35:38
 * @since JDK1.8
 */
@Data
public class TaskNodeFileVO {

    @ApiModelProperty("主键")
    private Long id;

    @ApiModelProperty("子任务ID")
    private Long subTaskId;

    @ApiModelProperty("任务环节实例ID")
    private Long taskNodeInstId;

    @ApiModelProperty("子任务环节实例ID")
    private Long subTaskNodeInstId;

    @ApiModelProperty("元素配置ID")
    private Long processConfigId;

    @ApiModelProperty("节点元素关系表ID")
    private Long processRelationId;

    @ApiModelProperty("相关业务id")
    private String moduleId;

    @ApiModelProperty("相关业务类型")
    private String moduleType;

    @ApiModelProperty("文件ID")
    private Long fileId;

    @ApiModelProperty("文件原名")
    private String fileOrigName;

    @ApiModelProperty("文件名")
    private String fileName;

    @ApiModelProperty("文件大小")
    private Long fileSize;

    @ApiModelProperty("文件位置")
    private Integer fileLocationType;

    @ApiModelProperty("文件访问URL")
    private String url;

    @ApiModelProperty("文件路径")
    private String filePath;

    @ApiModelProperty("文件来源")
    private String source;

    @ApiModelProperty("缺陷类型ID")
    private String defectTypeId;

    @ApiModelProperty("缺陷类型名")
    private String defectName;

    @ApiModelProperty("描述")
    private String remark;

    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty("更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    public static TaskNodeFileVO convertToTaskNodeFile(TaskNodeFileDTO taskNodeFileDTO) {
        if (taskNodeFileDTO == null) {
            return null;
        }
        TaskNodeFileVO taskNodeFileVO = new TaskNodeFileVO();
        taskNodeFileVO.setId(taskNodeFileDTO.getId());
        taskNodeFileVO.setProcessConfigId(taskNodeFileDTO.getProcessConfigId());
        taskNodeFileVO.setProcessRelationId(taskNodeFileDTO.getProcessRelationId());
        taskNodeFileVO.setSubTaskId(taskNodeFileDTO.getSubTaskId());
        taskNodeFileVO.setTaskNodeInstId(taskNodeFileDTO.getTaskNodeInstId());
        taskNodeFileVO.setSubTaskNodeInstId(taskNodeFileDTO.getSubTaskNodeInstId());
        taskNodeFileVO.setModuleId(taskNodeFileDTO.getModuleId());
        taskNodeFileVO.setModuleType(taskNodeFileDTO.getModuleType());
        taskNodeFileVO.setFileLocationType(taskNodeFileDTO.getFileLocationType());
        taskNodeFileVO.setFileId(taskNodeFileDTO.getFileId());
        taskNodeFileVO.setFileOrigName(taskNodeFileDTO.getFileOrigName());
        taskNodeFileVO.setFileName(taskNodeFileDTO.getFileName());
        taskNodeFileVO.setFilePath(taskNodeFileDTO.getFilePath());
        taskNodeFileVO.setFileSize(taskNodeFileDTO.getFileSize());
        taskNodeFileVO.setRemark(taskNodeFileDTO.getRemark());
        taskNodeFileVO.setUrl(taskNodeFileDTO.getUrl());
        taskNodeFileVO.setSource(taskNodeFileDTO.getSource());
        taskNodeFileVO.setCreateTime(taskNodeFileDTO.getCreateTime());
        taskNodeFileVO.setUpdateTime(taskNodeFileDTO.getUpdateTime());
        return taskNodeFileVO;
    }
}
